home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hal.preinst < prev    next >
Text File  |  2008-10-26  |  2KB  |  54 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. rm_conffile() {
  6.   PKGNAME="hal"
  7.   CONFFILE="$1"
  8.  
  9.   if [ -e "$CONFFILE" ]; then
  10.    md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  11.    old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  12.    if [ "$md5sum" != "$old_md5sum" ]; then
  13.      echo "Obsolete conffile $CONFFILE has been modified by you."
  14.      echo "Saving as $CONFFILE.dpkg-bak ..."
  15.      mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  16.    else
  17.      echo "Removing obsolete conffile $CONFFILE ..."
  18.      rm -f "$CONFFILE"
  19.    fi
  20.  fi
  21. }
  22.  
  23. case "$1" in
  24.   install|upgrade)
  25.     if dpkg --compare-versions "$2" le "0.5.2-1"; then
  26.       rm_conffile "/etc/hal/fdi/preferences.fdi"
  27.       rm_conffile "/etc/dev.d/block/hal-unmount.dev"
  28.     fi
  29.     if dpkg --compare-versions "$2" le "0.5.6-2"; then
  30.       rm_conffile "/etc/udev/scripts/device-removable.sh" 
  31.     fi
  32.     if dpkg --compare-versions "$2" le "0.5.6-4"; then
  33.       rm_conffile "/etc/hal/fdi/preferences.fdi"
  34.     fi
  35.     if dpkg --compare-versions "$2" le "0.5.7.1-1"; then
  36.       deluser --quiet --system hal > /dev/null || true
  37.     fi
  38.     if dpkg --compare-versions "$2" lt "0.5.9-3"; then
  39.       if [ -x /etc/dbus-1/event.d/20hal ]; then
  40.         /etc/dbus-1/event.d/20hal stop
  41.       fi
  42.       rm_conffile "/etc/dbus-1/event.d/20hal"
  43.     fi
  44.     if dpkg --compare-versions "$2" lt "0.5.11-3"; then
  45.       rm_conffile "/etc/udev/hal.rules"
  46.       rm -f /etc/udev/rules.d/z99_hal.rules
  47.       rm_conffile "/etc/udev/rules.d/95-hal.rules"
  48.     fi
  49. esac
  50.  
  51.  
  52.  
  53. exit 0
  54.